package com.westos.echufang.controller;

import com.westos.echufang.dao.EmployeeDao;
import com.westos.echufang.pojo.entity.Employee;
import com.westos.echufang.service.admin.AdminService;
import com.westos.echufang.service.admin.AdminServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class updateController {
    @Autowired
    AdminService adminService;
    @RequestMapping("/emp/update")
    public String toUpdate(int id,Model model){

      //  Employee empById = employeeDao.getEmpById(id);
        Employee emp = adminService.getEmpById(id);
        model.addAttribute("Qemployee",emp);
        return "update";
    }
    @RequestMapping("/updateEmp")
    public String updateEmp(Employee employee) {
       // employeeDao.update(employee);
        adminService.update(employee);
        return "redirect:/query/all";//查询全部书籍
    }
}
